package com.itheima.app.controller;

import com.itheima.app.manager.MakeFriendManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class BaiduController {


    @Autowired
    private MakeFriendManager makeFriendManager;
    /**
     * 上传地理位置
     *  最终往userLocation中存一条数据 或者 更新
     * @param map
     * @return
     */
    @PostMapping("/baidu/location")
    public Map baiduLocation(@RequestBody Map map){
        String latitude = map.get("latitude").toString(); //纬度
        String longitude = map.get("longitude").toString(); //经度
        String addrStr = map.get("addrStr").toString(); //地址
        System.out.println(map);
        makeFriendManager.saveOrUpdateUserLocation(latitude, longitude ,addrStr );
        return null;
    }
}
